"""这里__eq__方法(等于方法)并未搞懂,还有一个_ne__方法(不等方法_)"""

class Person(object):
    def __init__(self):
        self.name = "laowang"
    # 重写__eq__方法,可以搞定创建多个实例对象时保持
    def __eq__(self, other):
        return True  # 即 return self.name == other.name



if __name__ == "__main__":
    p1 = Person()
    p2 = Person()
    print(p1 == p2)
    print(id(p1))
    print(id(p2))
    """
    output:
        True
        140202178591824
        140202178592048
    """